home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / radiance / simplerd.lha / simplerad / FinalFTP / Light / bvol.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-21  |  3.5 KB  |  81 lines

  1. /**********************************************************************/
  2. /* bvol.h                                                             */
  3. /*                                                                    */
  4. /* Structures for hierarchical bounding volumes                       */
  5. /*                                                                    */
  6. /* Copyright (C) 1992, Bernard Kwok                                   */
  7. /* All rights reserved.                                               */
  8. /* Revision 1.0                                                       */
  9. /* May, 1992                                                          */
  10. /**********************************************************************/
  11. #ifndef BVOL_H
  12. #define BVOL_H
  13.  
  14. #define XX    0
  15. #define YY    1
  16. #define ZZ    2
  17. #define LOW    0
  18. #define HIGH    1
  19.  
  20. #define MAX_BV_CHILDREN 16     /* Keep the breadth of the tree small */
  21. /* Is p outside of the bounding box b */
  22. #define OutOfBounds(p,b) ((p)->x < b->min.x || (p)->x > b->max.x ||\
  23.               (p)->y < b->min.y || (p)->y > b->max.y||\
  24.               (p)->z < b->min.z || (p)->z > b->max.z)
  25.  
  26. /* For unlimited # of bounding volumes per bounding volume           */
  27. /* (not used) -- if use replace "child" definition in HBBox          */
  28. /* definition                                                        */
  29. typedef struct HHBox_List  {   /* Bounding volumes in bounding volume*/
  30.   struct HHBox *box;           /* bounding volume                    */
  31.   struct HHBox_List *next;     /* Next bounding volume ptr           */
  32. } HBBox_List;
  33.  
  34. typedef struct HBBox {         /* Hierarchical bounding volume node  */
  35.   double area;                 /* Area of bounding volume            */
  36.   BoundingBoxType *box;        /* bounding volume                    */
  37.   Objectt *object;             /* Object if any contained in         */
  38.                    /* bounding volume                    */
  39.   Polygon *poly;               /* Polygon if any contained in BV     */
  40.   struct HBBox *father;        /* Father bounding volume             */
  41.   int num_children;            /* Number of volumes contained in
  42.                   this node */
  43.   struct HBBox                 /* List of "child" volumes contained  */
  44.     *child[MAX_BV_CHILDREN];
  45.   int level;                   /* Level in tree                      */
  46. } HBBox;
  47.  
  48. typedef struct Object_List {   /* List of potential receivers        */
  49.   HBBox *hbox;                 /* Object volume in list              */
  50.   struct Object_List *next;    /* Next object ptr                    */
  51.   int is_receiver;             /* Is a receiver from some source     */
  52.   int is_obstructor;           /* Is possble obstructor of source from
  53.                   receiver */
  54. } Object_List;
  55.  
  56. #define UNCHANGED 0            /* Data ordering                      */
  57. #define SHUFFLE 1
  58. #define ALL_SPHERE 0           /* Bounding volume types              */
  59. #define ALL_BOX 1
  60. #define ALL_MIXED 2
  61.  
  62. typedef struct {               /* Bounding box options               */
  63.   int input_order;             /* Shuffle, or leave (default) input 
  64.                   data before building tree */
  65.   int boxtype;                 /* is data homogenous (default)       */
  66. } HBBox_OptionType;
  67.  
  68. /**********************************************************************/
  69. extern double BVH_Cost_Box();
  70. extern double BVH_Cost_Sphere();
  71. extern double BVH_IncrementalCost_Box();
  72. extern int IsLeafBox();
  73. extern int BVH_Cull();
  74.  
  75. extern void Print_ObjectList();
  76. extern void Init_ObjectList();
  77. extern void AddTo_ObjectList();
  78. extern void Make_ObjectList();
  79.  
  80. #endif /* BVOL_H */
  81.